package JZOffer;

// https://leetcode.cn/problems/fei-bo-na-qi-shu-lie-lcof/?envType=study-plan&id=lcof&plan=lcof&plan_progress=xxj1ozje
// 斐波那契数列
public class Day008_1 {
    public int fib(int n) {
        if (n < 2) {
            return n;
        }
        int a = 0;
        int b = 0;
        int c = 1;
        for (int i = 2; i <= n; i++) {
            a = b;
            b = c;
            c = (a+b) % 1000000007;
        }
        return c;
    }
}
